<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" ng-app="loginApp">
<head>
    <meta charset="UTF-8">
    <title>login</title>
    <style>
        .loginOuter {
            width: 0;
            height: 0;
            position: fixed;
            left: 50%;
            top: 50%;
        }

        .loginInter {
            width: 55em;
            height: 20em;
            margin-left: -27.5em;
            margin-top: -12em;
            padding: 1em;
        }

        .loginImg {
            width: 28em;
            height: 18em;
        }

        .loginForm {
            width: 23em;
            height: 18em;
            padding-left: 3em;
            border-left: dotted 1px lightgrey;
        }
    </style>
    <link rel="stylesheet" type="text/css" href="/static/css/base.css">
    <link rel="stylesheet" type="text/css" href="/static/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="/static/css/font-awesome.min.css">

</head>
<body>
<div th:include="fragment::files"></div>
<div class="loginOuter">
    <div class="loginInter">
        <div class="pull-left loginImg">
            <img src="">
        </div>
        <div class="pull-right loginForm" ng-controller="loginController">
            <form name="loginForm">
                <fieldset class="form-group">
                    <div class="input-group">
                        <div class="input-group-addon"><i class="fa fa-user"></i></div>
                        <input type="text" class="form-control" placeholder="用户名" ng-model="user.name">
                    </div>
                </fieldset>
                <fieldset class="form-group">
                    <div class="input-group">
                        <div class="input-group-addon"><i class="fa fa-lock"></i> </div>
                        <input type="password" class="form-control" placeholder="密码" ng-model="user.password">
                    </div>
                </fieldset>
                <button type="button" class="btn btn-info-outline btn-block">登&nbsp;&nbsp;录</button>
                <fieldset class="form-group">
                   <div style="padding-top: 20px;">
                       <label><input type="checkbox"  value="true" ng-model="user.rememberMe">&nbsp;记住我</label>
                       <a href="/register" class="pull-right">去注册<i class="fa fa-arrow-circle-right"></i></a>
                   </div>
                </fieldset>
            </form>
        </div>
    </div>
</div>
</body>
<script type="text/javascript" th:inline="javascript">
    var app = angular.module('loginApp', []);
    app.controller('loginController', function ($scope,$http) {
        $scope.user = {
            name:'',
            password:'',
            rememberMe:false
        };
        $scope.login = function () {
            $http.post('/user/login',{params:{
                name:$scope.user.name,
                password:$scope.user.password,
                rememberMe:$scope.user.rememberMe
            }}).success(function (data) {
                if(data.code){
                    location.href = data.jumpUrl;
                }else{
                    alert(data.detail);
                }
            });
        };
    });
</script>
</html>